import Vue from 'vue';
import axios from './router/axios';
import VueAxios from 'vue-axios';
import App from './App';
import router from './router/router';
import './permission'; // 权限
import './error'; // 日志
import store from './store';
import {
    loadStyle
} from './util/util'
import * as urls from '@/config/env';
import Element from 'element-ui';
import {
    iconfontUrl,
    iconfontVersion
} from '@/config/env';
import i18n from './lang' // Internationalization
import './styles/common.scss';
import BaiduMap from 'vue-baidu-map'

import basicContainer from './components/basic-container/main';
import Distpicker from 'v-distpicker';

Vue.component('v-distpicker', Distpicker)
// import rongyun from '@/assets/rongyun/RongIMLib-2.4.0.min.js'
import {
    JSEncrypt
} from 'jsencrypt'
Vue.prototype.$getData = function (val) {
    let encrypt = new JSEncrypt()
    encrypt.setPublicKey('MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC8HaSSz1ARBkTOmythz8Zk2oKWYaLU1gA1MsQaKRj5UwA/DMdKVy7CDE070PCecTiBfqCDmdvzOn+G0G/gr4p6KXeXI00KZArXPBDSd0HSUGwuCsFpLppr1q1H4MluvMOsaiAdh7mLCnMxOag0Vjq6oBbXXM2lYkpTxBD4w90eiQIDAQAB')
    let data = encrypt.encrypt(val)
    return data
}

Vue.use(BaiduMap, {
    // ak 是在百度地图开发者平台申请的密钥 详见 http://lbsyun.baidu.com/apiconsole/key */
    ak: 'Yp1pLz2E5cMfVVqC73wRlTfftjLMPUMNp'
})
Vue.use(router)
Vue.use(VueAxios, axios)
Vue.use(Element, {
    i18n: (key, value) => i18n.t(key, value)
})
Vue.use(window.AVUE, {
    i18n: (key, value) => i18n.t(key, value)
})
// Vue.prototype.rongyun = rongyun

//注册全局容器
Vue.component('basicContainer', basicContainer)
// 加载相关url地址
Object.keys(urls).forEach(key => {
    Vue.prototype[key] = urls[key];
})

// 动态加载阿里云字体库
iconfontVersion.forEach(ele => {
    loadStyle(iconfontUrl.replace('$key', ele));
})

Vue.config.productionTip = false;
/* eslint-disable */
new Vue({
    router,
    store,
    i18n,
    render: h => h(App)
}).$mount('#app')